package com.gxa.web_admin.controller.operationscontroller;

import com.gxa.common.R;
import com.gxa.modules.pojo.Content;
import com.gxa.modules.service.operationsservice.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/content")
public class ContentController {


    @Autowired
    ContentService contentService;

    @GetMapping("/selectContent")
    public R selectContent(@RequestParam int page,@RequestParam int size,String title,String contentType)
    {
        return contentService.selectContent(page, size, title, contentType);
    }

    @GetMapping("/selectComment")
    public R selectComment(@RequestParam int page,@RequestParam int size,String title,String contentType)
    {
        return contentService.selectComment(page, size, title, contentType) ;
    }
    @PostMapping("/insertContent")
    public R insertContent(@RequestBody Content content)
    {
        return contentService.insertContent(content);
    }
    @GetMapping("/selectContentById")
    public R selectContentById(@RequestParam int id)
    {
        return contentService.selectContentById(id);
    }
    @PostMapping("/updateContentById")
    public R updateContentById(@RequestBody Content content)
    {
        return contentService.updateContentById(content);
    }
    @PostMapping("/deleteContentById")
    public R deleteContentById(@RequestParam int id)
    {
        return contentService.deleteContentById(id);
    }

    @PostMapping("/deleteContentByPatch")
    public R deleteContentByPatch(int[] ids)
    {
        return contentService.deleteContentByPatch(ids);
    }
}
